Part Number Hot Search : 
CSB1065N H1038T 7805A 1808611 SSD1809T AK4184 F1012 AN1F4Z
Product Description
Full Text Search
 

To Download 68HCS12 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  ee 308 spring 2003 68HCS12 addr ess space 68HCS12 has 16 address lines 68HCS12 can address  distinct locations f or 68HCS12, each location holds one byte (eight bits) 68HCS12 can address  bytes  

              kb (        68HCS12 can address 64 kb 1
ee 308 spring 2003 68HCS12 addr ess space lo west address:                      highest address:                 


 0x0000 0xffff 65535 0 2 ? 1 16 2
ee 308 spring 2003 memor y types ram: random access memory (can read and write) r om: read only memory (programmed at f actory) pr om: programmable read only memory (program once at site) epr om: erasable programmable read only memory (program at site, can erase using uv light and reprogram) eepr om: electrically erasable programmable read only memory (program and erase using v oltage rather than uv light) 68HCS12 has: 12 k ram 4 kb eepr om can erase and reprogram an y byte using normal 5v po wer supply 256 kb flash eepr om can erase using e xternal 12v po wer supply 3
ee 308 spring 2003 0x0000 registers 0x03ff 1 k bytes 68HCS12 address space 0x1000 0x0400 0x0fff 0x3fff d?bug 12 ram 0x4000 0xffff d?bug 12 flash eeprom user ram 0x3bff 0x3c00 1 k 11 k 3 k bytes eeprom 4
ee 308 spring 2003 68HCS12 alu arithmetic logic unit (alu) is where instructions are e x ecuted. examples of instructions are arithmetic (add, subtract), logical (bitwise and, bitwise or), and comparison. 68HCS12 has tw o 8-bit re gisters for e x ecuting instructions. these re gisters are called a and b . f or e xample, the hcs12 can add the 8-bit number stored in b to the eight-bit number stored in a using the instruction ab a (add b to a): combinational block a b clock (add b to a) control (0x1806 = aba) when the control unit sees the sixteen-bit number 0x1806 , it tells the alu to add b to a , and store the result into a . 5
ee 308 spring 2003 68HCS12 pr ogramming model a programming model details the re gisters in the alu and con- trol unit which a programmer needs to kno w about to program a microprocessor . re gisters a and b are part of the programming model. some instructions treat a and b as a sixteen-bit re gister called d for such things as adding tw o sixteen-bit numbers. note that d is the same as a and b . 0 b d 0 0 15 a 7 7 the hcs12 can w ork with 8-bit numbers (bytes) and 16-bit numbers (w ords). the size of w ord the hcs12 uses depends on the instruction. f or e xample, the instruction ld aa (load accumulator a) puts a byte into a , and ldd (load double accumulator) puts a w ord into d . 6
ee 308 spring 2003 68HCS12 pr ogramming model the 68HCS12 has a sixteen-bit re gister which tells the control unit which instruction to e x ecute. this is called the program counter ( pc ). the number in pc is the address of the ne xt in- struction the hc12 will e x ecute. the 68HCS12 has an eight-bit re gister which tells the hcs12 about the state of the alu. this re gister is called the condition code re gister (ccr). f or e xample, one bit (c) tells the hcs12 whether the last instruction e x ecuted generated a carry . another bit (z) tells the hcs12 whether the result of the last instruction w as zero. the n bit tells whether the last instruction e x ecuted generated a ne g ati v e result. there are three other 16-bit re gisters C x, y , sp C which we will discuss later . 0 15 0 15 0 15 0 15 0 b d x y sp pc ccr 0 0 15 a 7 7 n i h x s z v c 7
ee 308 spring 2003 some hcs12 instructions needed f or lab 1 ldaa address put the byte contained in memory at address into a staa address put the byte contained in a into memory at address clra clear a (0 -> a ) inca add 1 to a (( a ) + 1 -> a ) aba add b to a , store the result in a asra shift a right by one bit (k eep the msb the same) this di vides a signed byte by 2 lsra shift a right by one bit (put 0 into msb) this di vides an unsigned byte by 2 nega ne g ate a (-( a ) -> a ) tab t ransfer a to b (( a ) -> b ) swi softw are interrupt (used to end all our hcs12 programs) 8
ee 308 spring 2003 a simple hcs12 pr ogram all programs and data must be placed in memory between ad- dress 0x1000 and 0x3bff . f or our short programs we will put the ?rst instruction at 0x1000 , and the ?rst data byte at 0x1100 consider the follo wing program: ldaa $1113 ; put contents of memory at 0x1113 into a inca ; add one to a staa $1114 ; store the result into memory at 0x1114 swi ; end program if the ?rst instruction is at address 0x1000 , the follo wing bytes in memory will tell the hcs12 to e x ecute the abo v e program: address value instruction 0x1000 b6 ldaa $1113 0x1001 11 0x1002 13 0x1003 42 inca 0x1004 7a staa $1114 0x1005 11 0x1006 14 0x1007 3f swi if the contents of address 0x1113 were 0xa2 , the program w ould put an 0xa3 into address 0x1114 . 9
ee 308 spring 2003 a simple assembly language pr ogram. it is dif ?cult for humans to remember the numbers (op codes) for computer instructions. it is also hard for us to k eep track of the addresses of numerous data v alues. instead we use w ords called mnemonics to represent instructions, and labels to repre- sent addresses, and let a computer program called an assembler to con v ert our program to binary numbers (machine code). here is an assembly language program to implement the pre vi- ous program: prog equ $1000 ; start program at 0x1000 data equ $1113 ; data value at 0x1113 result equ $1114 ; result at 0x1114 org prog code: section .text ldaa data inca staa result swi w e w ould put this code into a ?le and gi v e it a name, such as test.s note that equ , org , and section are not instructions for the hcs12 b ut are directi v es to the assembler which mak e it possi- ble for us to write assembly language programs. the y are called assembler directi v es or pseudo-ops. f or e xample the pseudo-op org tells the assembler that the starting address (origin) of our program should be 0x1000 . 10
ee 308 spring 2003 assembling an assembly language pr ogram a computer program called an assembler can con v ert an assem- bly language program into machine code. the assembler we use in class is from a compan y called cosmic. t o assemble the abo v e program using the cosmic assembler , we must ?rst create a ?le called test.lkf which tells the assem- bler where to put things in memory . our test.lkf ?le w ould look lik e this: # link file for test program +seg .text -b 0x1000 -n .text # program start address +seg .data -b 0x1100 -n .data # data start address test.o # application program t o assemble the program, use the follo wing commands: ca6812 -a -l -xx -pl test.s clnk -o test.h12 -m test.map test.lkf chex -o test.s19 test.h12 this will produce a ?le called test.s19 which we can load into the 68HCS12. 11


▲Up To Search▲   

 
Price & Availability of 68HCS12

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X